#include <stdio.h>
#include <stdlib.h>
#include "creat.h"
#define MAXSIZE 100
void level_traversal(tree *root)
{
    tree *queue[MAXSIZE];
    int front, rear;
    front = rear = 0;
    queue[rear++] = root;
    while (front != rear)
    {
        tree *p = queue[front++];
        printf("%3d", p->data);
        if (p->left)
        {
            queue[rear++] = p->left;
        }
        if (p->right)
        {
            queue[rear++] = p->right;
        }
    }
}
int main()
{
    /*******************code*******************/
    tree *root = creat();
    level_traversal(root);
    /******************************************/
    printf("\n\n****************************\n");
    printf("Press Enter key to continue\n");
    getchar();
    return 0;
    /******************************************/
}
